using System;
using System.Collections.Generic;
using System.Text;

using PickGold;
using PickGold.Database;
using PickGold.Entities.Table;

namespace PickGold.Entities.View
{
    public abstract partial class CRadixReplyInfo : CBaseTable
    {
        //
        public const string ENTITY_KEY = "reply_id";
        public const string ENTITY_SYMBOL = "reply_name";
        //
        public const string USER_ID = CBaseUserInfo.ENTITY_KEY;
        public const string ITEM_VALUE = "item_value";
        public const string ITEM_CREATE = "item_create";
        //
        private SRadixReplyInfo _ = null;
        //
        public CRadixReplyInfo(string name) : base(name) { }
        public CRadixReplyInfo(string name, string alias) : base(name, alias) { }
        public CRadixReplyInfo(CDatabase db, string name) : base(db, name) { }
        public CRadixReplyInfo(CDatabase db, string name, string alias) : base(db, name, alias) { }
        //
        protected override void SetSchema()
        {
            this.SetSchema(new SRadixReplyInfo ());
        }
        protected void SetSchema(SRadixReplyInfo s)
        {
            this._ = s;
            base.SetSchema(s);
        }
        //
        protected override void PreInitSchema()
        {
            base.PreInitSchema();
            this._DataTable.Columns.Add(USER_ID, typeof(long)).DefaultValue = this._.UserID;
            this._DataTable.Columns.Add(ITEM_VALUE, typeof(string)).MaxLength = 4000;
            this._DataTable.Columns.Add(ITEM_CREATE, typeof(DateTime)).DefaultValue = this._.ItemCreate;
        }
        //
        #region Property
        //
        public long UserID
        {
            set
            {
                this._.UserID = value;
                this.SetValue(USER_ID, value);
            }
            get
            {
                return this._.UserID;
            }
        }
        //
        public string ItemValue
        {
            set
            {
                this._.ItemValue = value;
                this.SetValue(ITEM_VALUE, value);
            }
            get
            {
                return this._.ItemValue;
            }
        }
        //
        public DateTime ItemCreate
        {
            set
            {
                this._.ItemCreate = value;
                this.SetValue(ITEM_CREATE, value);
            }
            get
            {
                return this._.ItemCreate;
            }
        }
        //
        #endregion
        //
        public override bool MoveTo(int position)
        {
            if (!base.MoveTo(position))
                return false;
            this._.UserID = this.GetValue<long>(USER_ID);
            this._.ItemValue = this.GetValue<string>(ITEM_VALUE);
            this._.ItemCreate = this.GetValue<DateTime>(ITEM_CREATE);
            return true;
        }
        //
    }
    //
    public class SRadixReplyInfo : SBaseTable
    {
        //
        public long UserID = -1;
        public string ItemValue = null;
        public DateTime ItemCreate = DateTime.MinValue;
        //
    }
    //
}
//
